﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using IceDog.DNC.Web.Swashbuckle1_X.EnumData;
using IceDog.DNC.Web.Swashbuckle1_X.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace IceDog.DNC.Web.Swashbuckle1_X.Controllers
{
    [Produces("application/json")]
    [Route("api/Account")]
    public class AccountController : Controller
    {
        /// <summary>
        /// Get
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult Get()
        {
            return Ok("this is very ok");
        }
        
        /// <summary>
        /// GetUserType
        /// </summary>
        /// <param name="type">UserType</param>
        /// <returns>get the user type</returns>
        [HttpGet,Route("GetUserType")]
        public User GetUserType(UserType type)
        {
            return new User
            {
                UserName = "andy",
                UserType = type
            };
        }

        /// <summary>
        /// GetUserType
        /// </summary>
        /// <param name="type">UserType</param>
        /// <returns>get the user type</returns>
        [HttpGet, Route("GetError")]
        public IActionResult GetError()
        {
            throw new ArgumentException("param a is null");
        }
    }
}